home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Caste wipe R-L.c < prev    next >
Text File  |  1993-08-23  |  2KB  |  51 lines

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define        gap                14       /* width of strip */
  15. #define CorrectTime 1
  16.  
  17. void CasteWipeRL(GrafPtr);
  18.  
  19. /* This takes a strip (starting with the leftmost strip, moving right) and
  20.    copies it into all the strips starting at the right and moving left until
  21.    its in the right place. */
  22.    
  23. void CasteWipeRL(GrafPtr sourceGrafPtr)
  24. {
  25.     int        srcx, barpos;
  26.     Rect    src, dest;
  27.     Boolean    everyOther;
  28.     
  29.     everyOther=FALSE;
  30.     src.top = 0;                       /* constant */
  31.     src.bottom = MAIN_WINDOW_HEIGHT;   /* constant */
  32.     
  33.     for(srcx = 0; srcx < MAIN_WINDOW_WIDTH; srcx += gap)
  34.     {
  35.         for(barpos = 0; barpos + gap < MAIN_WINDOW_WIDTH; barpos += gap);
  36.         for(; barpos >= srcx; barpos -= gap)
  37.         {
  38.             StartTiming();
  39.             src.left = srcx;
  40.             src.right = srcx + gap;
  41.             dest = src;
  42.             dest.left = barpos;
  43.             dest.right = barpos + gap;
  44.             CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  45.                     &src, &dest, 0, 0L);
  46.             if (everyOther)                        /* really, we need time */
  47.                 TimeCorrection(CorrectTime);       /* correction 0.5, but  */
  48.             everyOther=!everyOther;                /* this will do (gag)   */
  49.         }
  50.     }
  51. }